from constants import *
import pygame, sys
from pygame.locals import *
import random
# 食物组件
class FOOD :
    Unit = 10
    def __init__(self, mp) :
        self.x = random.randint(int(mp.Left / FOOD.Unit + 1), int(mp.Width / FOOD.Unit)) * FOOD.Unit
        self.y = random.randint(int(mp.Top / FOOD.Unit + 1), int(mp.Height / FOOD.Unit)) * FOOD.Unit
        self.pos = [self.x, self.y]
        self.Rect = [self.x, self.y, FOOD.Unit, FOOD.Unit]
    def printFood(self, screen) :
        pygame.draw.rect(screen, foodColor, self.Rect)